var md_common=(function($){
	var app={
		//提示信息
		showMessage:function(message){
			if($("#messageModal").size()==0){
				var html='<div class="modal fade" id="messageModal" tabindex="-1" role="dialog"'+
	   			'aria-labelledby="myModalLabel" aria-hidden="true">'+
	   			'<div class="modal-dialog">'+
	      		'<div class="modal-content">'+
	         	'<div class="modal-header">'+
	            '<button type="button" class="close"'+ 
	             'data-dismiss="modal" aria-hidden="true">&times;'+
	            '</button> <h4 class="modal-title" id="myModalLabel">提示信息</h4></div>'+
				'<div class="modal-body">'+message+'</div>'+
				'<div class="modal-footer">'+
				'<button type="button" class="btn btn-default"'+ 
				'data-dismiss="modal">确定</button></div></div></div>';
				$("body").append(html);
			}
			$("#messageModal").modal();
		},
		//操作提示信息
		showConfirm:function(message,success){
			if($("#confirmeModal").size()==0){
				var html='<div class="modal fade" id="confirmeModal" tabindex="-1" role="dialog"'+
	   			'aria-labelledby="myModalLabel" aria-hidden="true">'+
	   			'<div class="modal-dialog">'+
	      		'<div class="modal-content">'+
	         	'<div class="modal-header">'+
	            '<button type="button" class="close"'+ 
	             'data-dismiss="modal" aria-hidden="true">&times;'+
	            '</button> <h4 class="modal-title" id="myModalLabel">提示信息</h4></div>'+
				'<div class="modal-body">'+message+'</div>'+
				'<div class="modal-footer">'+
				'<button type="button" class="btn btn-default"'+ 
				'data-dismiss="modal">取消</button><button type="button" class="btn btn-primary success_confirm">确定</button></div></div></div>';
				$("body").append(html);
			}
			$("#success_confirm").unbind("click").on("click",function(){
				if(typeof success=="function"){
					$("#confirmeModal").modal('hide');
					success();
				}
			});
			$("#confirmeModal").modal();
		},
		//ajaxpost请求
		postAjax:function(url,data,success,error){
			$.ajax({
				url:url,
				data:data,
				type:"post",
				dataType:"json",
				success:function(result){
					if(typeof success =="function"){
						success(result);
					}
				},
				error:function(){
					if(typeof error =="function"){
						error();
					}
				}
			});
		}
	}
	return app;
})($);
